package testcode;

import java.io.IOException;

import javax.jmdns.JmDNS;
import javax.jmdns.ServiceEvent;
import javax.jmdns.ServiceInfo;
import javax.jmdns.ServiceListener;
import javax.jmdns.impl.JmDNSImpl;

public class jmstester implements ServiceListener{
	JmDNS searcher;
	
	public void jmdns_run(){
		try {
			searcher = JmDNS.create();
		} catch (IOException e) {
			e.printStackTrace();
		}
		searcher.addServiceListener("_http._tcp.local.", new jmstester());
	}

	@Override
	public void serviceAdded(ServiceEvent event) {
		System.out.println("Service added   : " + event.getName() + "." + event.getType());
		
	}


	@Override
	public void serviceRemoved(ServiceEvent event) {
		 System.out.println("Service removed : " + event.getName() + "." + event.getType());

		
	}


	@Override
	public void serviceResolved(ServiceEvent event) {
		 System.out.println("Service resolved: " + event.getInfo());
		
	}
	
	
	
	public static void main(String[] args){
		jmstester jm = new jmstester();
		
		jm.jmdns_run();
	}
}
